package com.jinhongone.pattern.behavior.observer;

/**
 * @author jinho
 * @className Test
 * @description 客户端
 * @date 2025/4/16 16:00
 */
public class Test {
    public static void main(String[] args) {
        //定义观察者
        WeiXinUser zhangSan = new WeiXinUser("zhangSan");
        WeiXinUser LiSi = new WeiXinUser("LiSi");
        WeiXinUser WangWu = new WeiXinUser("WangWu");
        //观察者订阅主题
        SubscribeSubject subscribeSubject = new SubscribeSubject();
        subscribeSubject.attach(zhangSan);
        subscribeSubject.attach(LiSi);
        subscribeSubject.attach(WangWu);
        //主题开始变更
        subscribeSubject.notify("小红旗广播电视台开启广播....");

        subscribeSubject.detach(WangWu);
        subscribeSubject.notify("小红旗广播电视台开启第二次广播....");
    }
}
